package io.zim.modules.ws.handler.impl;


import com.alibaba.fastjson.JSONObject;
import io.zim.common.utils.R;
import io.zim.modules.ws.config.ShowcaseServerConfig;
import io.zim.modules.ws.handler.WsMsgHandler;
import org.tio.websocket.common.WsResponse;

/**
 *  默认的处理类
 * @author
 * @since
 */
public class DefaultMsgHandler implements WsMsgHandler {

  private R result  = null;

  public DefaultMsgHandler() {
  }

  public DefaultMsgHandler(R result) {
    this.result = result;
  }

  @Override
  public WsResponse handle(){
    return WsResponse.fromText(JSONObject.toJSONString(result), ShowcaseServerConfig.CHARSET);
  }
}

